package com.railway.dao.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

import com.railway.bean.Basic;
import com.railway.bean.BasicDetailed;
import com.railway.bean.Images;
import com.railway.bean.ImagesDetailed;
import com.railway.bean.Province;
import com.railway.bean.Station;
import com.railway.bean.Title;
import com.railway.dao.BasicDao;
import com.railway.util.DBUtil;

public class BasicDaoImpl implements BasicDao {
	JdbcTemplate jt = new JdbcTemplate(DBUtil.getDataSource());
	@Override
	public List<Basic> selectBasic(int service_id) {
		String sql = "SELECT * FROM 12306service WHERE service_id = ? ";
		return jt.query(sql, new BeanPropertyRowMapper<Basic>(Basic.class),service_id);
	}
	@Override
	public List<BasicDetailed> selectBasicDetailed(int basicDetailed_id) {
		String sql = "SELECT * FROM 12306servicedetailed WHERE service_detailed_id = ? ";
		return jt.query(sql, new BeanPropertyRowMapper<BasicDetailed>(BasicDetailed.class),basicDetailed_id);
	}
	@Override
	public List<Title> selectTitle(int title_id) {
		String sql = "SELECT * FROM title WHERE title_id = ? ";
		return jt.query(sql, new BeanPropertyRowMapper<Title>(Title.class),title_id);
	}
	@Override
	public List<Province> selectProvince(int province_id) {
		String sql = "SELECT * FROM province WHERE province_id = ? ";
		return jt.query(sql, new BeanPropertyRowMapper<Province>(Province.class),province_id);
	}
	@Override
	public List<Images> selectImages(int images_id) {
		String sql = "SELECT * FROM images WHERE images_id = ? ";
		return jt.query(sql, new BeanPropertyRowMapper<Images>(Images.class),images_id);
	}
	@Override
	public List<Station> selectStation(int station_id) {
		String sql = "SELECT * FROM station WHERE station_id = ? ";
		return jt.query(sql, new BeanPropertyRowMapper<Station>(Station.class),station_id);
	}
	@Override
	public List<ImagesDetailed> selectImagesDetailed(int imagesDetailed_id) {
		String sql = "SELECT * FROM imagesDetailed WHERE imagesDetailed_id = ? ";
		return jt.query(sql, new BeanPropertyRowMapper<ImagesDetailed>(ImagesDetailed.class),imagesDetailed_id);
	}

}
